<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
	</head>
	<body>
		<script src="./js/vue.js"></script>
		<div id="app">
			<p>{{counter}}</p>
			<cpn :child-counter="counter" @change='changeTotal'></cpn>
		</div>
		
		<template id="cpnT">
			<div>
				<button @click="increase">+</button>
				<button @click="decrease"></button>
			</div>
		</template>
		
		<script>
		const cpn = {
			template:`#cpnT`,\,
			data(){
				return {
					dCounter:this.childCounter
				}
			},
			props:{
				childCounter:Number
			},
			methods:{
				increase(){
					this.childCounter++
					this.$emit("",this.dCounter)
				},
				decrease(){
					
				}
			}
		}
		let app = new Vue({
			el:"#app",
			data:{
				counter:0
			},
			components:{
				cpn
			},
			methods:{
				changeTotal(value){
					this.counter = value
				}
			}
		})
		</script>
	</body>
</html>
